const mysql = require("mysql2");
const poolConf = {
  host: "localhost",
  database: "sequelize",
  user: "root",
  password: "mWXS19971222@.",
  port: 3306,
};
const dbPool = {
  pool: {},
  create() {
    this.pool = mysql.createPool(poolConf);
  },
  close() {
    this.pool.end();
  },
  connect(sql, arr, fun) {
    this.pool.getConnection(function (err, connection) {
      connection.query(sql, arr, fun);
      connection.release();
    });
  },
};
dbPool.create();
module.exports = dbPool;
